'use strict'
let vk
const dbName = {
  //test: "vk-test",
}

let db = uniCloud.database()
let _ = db.command
let $ = _.aggregate

let cloudObject = {
  isCloudObject: true,

  _before: async function () {
    vk = this.vk
    // let { customUtil, uniID, config, pubFun } = this.getUtil(); // 获取工具包
  },

  _after: async function (options) {
    let { err, res } = options
    if (err) {
      return
    }
    return res
  },
  oneClickLogin: async function (data) {
    let res = { code: 0, msg: '' }
    res.data = await uniCloud.getPhoneNumber({
      appid: '__UNI__A72B031',
      provider: 'univerify',
      access_token: data.access_token,
      openid: data.openid
    })
		// res.data = data
    return res
  }
}

module.exports = cloudObject
